package com.runvp.common.config;

import com.runvp.common.util.ToolUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取netty相关配置
 *
 * @author xkk
 */
@Component
@ConfigurationProperties(prefix = "netty")
public class NettyConfig {

    /**
     * ip
     */
    private static String ip;
    /**
     * ip
     */
    private static String port;

    /**
     * 最大出液脉冲量
     */
    private static Long maxPulse;

    /**
     * 心跳周期
     */
    private static String xlCycle;
    /**
     * 每层端口数设置
     */
    private static String cargoWay;

    /**
     * 脉冲与重量换算基数 500g = 37脉冲
     */
    private static Integer pulseConversion = 37;

    public static String getIp() {
        return ip;
    }

    public  void setIp(String ip) {
        NettyConfig.ip = ip;
    }

    public static String getPort() {
        return port;
    }
    public static int getIntPort() {
        return ToolUtils.toInt(port);
    }
    public  void setPort(String port) {
        NettyConfig.port = port;
    }
    public static String getCargoWay() {
        return cargoWay;
    }

    public void setCargoWay(String cargoWay) {
        NettyConfig.cargoWay = cargoWay;
    }
    public static Long getMaxPulse() {
        return maxPulse;
    }

    public void setMaxPulse(Long maxPulse) {
        NettyConfig.maxPulse = maxPulse;
    }

    public static String getXlCycle() {
        return xlCycle;
    }

    public void setXlCycle(String xlCycle) {
        NettyConfig.xlCycle = xlCycle;
    }

    public static Integer getPulseConversion() {
        return pulseConversion;
    }

    public void setPulseConversion(Integer pulseConversion) {
        NettyConfig.pulseConversion = pulseConversion;
    }
}